import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsISO8601, IsNotEmpty, IsNumber, IsOptional, IsPositive, IsString, MaxLength } from "class-validator";

export class CreateOutputDto {
  @ApiProperty({ description: "项目 ID", example: "proj_123" })
  @IsString()
  @IsNotEmpty()
  projectId!: string;

  @ApiProperty({ description: "产值数值", example: 128.5 })
  @Type(() => Number)
  @IsNumber()
  @IsPositive()
  value!: number;

  @ApiProperty({ description: "产值上报日期", example: "2025-09-24" })
  @IsISO8601()
  date!: string;

  @ApiPropertyOptional({ description: "备注", maxLength: 500 })
  @IsOptional()
  @IsString()
  @MaxLength(500)
  note?: string;
}
